<template>
	<div>
		<!--
        	作者：1040117458@qq.com
        	时间：2017-08-02
        	描述：点击报表中的新保续保个数使用的组件
        -->
		<el-row :gutter="24" v-if="interFaceShow == 'order'">
			<el-col :span="24" style="text-align: right;">
				<el-button type="primary" size="small" @click="back">返回</el-button>
			</el-col>
		</el-row>
		<el-row :gutter="24" v-if="interFaceShow == 'order'">
			<el-table :data="orderData.dataList" border style="width: 100%;align-content: center;">
				<el-table-column label="车牌号" prop="plateNum" width="100">
				</el-table-column>
				<el-table-column label="被保险人" align="right" prop="insured" width="90">
				</el-table-column>
				<el-table-column label="联系电话" align="right" prop="contactPhone" width="120">
				</el-table-column>
				<el-table-column label="投保公司" align="right" prop="insuranceCompanyName" width="200">
				</el-table-column>
				<el-table-column label="商业险合同号" align="right" prop="syContractNo" width="120">
				</el-table-column>
				<el-table-column label="商业险开始日期" align="right" prop="syStartDate" width="130">
				</el-table-column>
				<el-table-column label="商业险结束日期" align="right" prop="syStopDate" width="130">
				</el-table-column>
				<el-table-column label="商业险金额" align="right" prop="syPrice" width="110">
				</el-table-column>
				<el-table-column label="交强险合同号" align="right" prop="jqContractNo" width="120">
				</el-table-column>
				<el-table-column label="交强险开始日期" align="right" prop="jqStartDate" width="130">
				</el-table-column>
				<el-table-column label="交强险结束日期" align="right" prop="jqStopDate" width="130">
				</el-table-column>
				<el-table-column label="交强险金额" align="right" prop="jqPrice" width="110">
				</el-table-column>
				<el-table-column label="返现金额" align="right" prop="backPrice" width="90">
				</el-table-column>
				<el-table-column label="返现状态" align="right" prop="backType" :formatter="backTypeCov" width="90">
				</el-table-column>
				<el-table-column label="退单状态" align="right" prop="returnType" :formatter="returnTypeCov" width="90">
				</el-table-column>
			</el-table>
			<el-pagination small @size-change="handleSizeChanges" @current-change="handleCurrentChanges" :current-page="CurentPages" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="orderData.total">
			</el-pagination>
		</el-row>
	</div>
</template>

<script>
	export default {
		data: function() {
			return {
				interFaceShow: this.show,
				CurentPages: 1,
				page: this.page,
				//保险单查询条件
				orderMapData:this.data,
				//保险单数据
				orderData: {
					total: 0,
					dataList: []
				},
			}
		},
		props:{
			show:false,
			data:null,
		},
		watch:{
			interFaceShow: function() {
				this.$emit('showChange');
			}
		},
		methods: {
			//返回按钮
			back: function() {
				this.$emit('showChange');
			},
			//保险单查询
			orderQuery: function() {
				debugger;
				this.$http.post(this.API_ROOT + '/insurance/Order/page', this.data, {
					params: {
						limit: this.page.pageSize,
						start: this.$data.CurentPages
					}
				}).then(resp => {
					debugger;
					if(resp.data.success) {
						resp.data.total = parseInt(resp.data.total);
						// es5写法
						this.$data.orderData = resp.data;
						for(var i = 0; i < this.$data.orderData.dataList.length; i++) {
							if(this.$data.orderData.dataList[i].insuranceCommissionerName) {
								this.$data.orderData.dataList[i].insuranceCompanyName = this.$data.orderData.dataList[i].insuranceCompanyName + "/" + this.$data.orderData.dataList[i].insuranceCommissionerName;
							} else {
								this.$data.orderData.dataList[i].insuranceCompanyName = this.$data.orderData.dataList[i].insuranceCompanyName + "/" + this.$data.orderData.dataList[i].uName;
							}
						}
						//this.baseQuery(this.$data.curTreeDeptId);
						//this.$data.exFormShow = false;
					} else {
						//debugger;
						this.$message.error(resp.data.msg);
					}
				}, resp => {});
			},
			//退单状态转换
			returnTypeCov: function(row, column) {
				var temp = '';
				switch(row.returnType) {
					case '0':
						temp = "未退保";
						break;
					case '1':
						temp = '已退保';
						break;
					default:
						''
						break
				};
				return temp;
			},

			//返现状态转换
			backTypeCov: function(row, column) {
				var temp = '';
				switch(row.backType) {
					case '0':
						temp = "未返现";
						break;
					case '1':
						temp = '已返现';
						break;
					default:
						''
						break
				};
				return temp;
			},
			handleSizeChanges: function() {

			},
			//baoxiandan fenye
			handleCurrentChanges: function(currentPage) {
				this.$data.CurentPages = currentPage;
				this.orderQuery();
			},
		},
		created: function() {
			this.orderQuery();
		}
	}
</script>

<style>
</style>